package chapter4.No4_1_使用reentrantLock类.demo12;

import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by Administrator on 2016/11/21.
 */
public class ServiceClass {

    ReentrantLock lock = new ReentrantLock();

    public void methodA() {
        lock.lock();
        System.out.println("getHoldCount()=" + lock.getHoldCount());
        methodB();
        lock.unlock();
    }

    public void methodB() {
        lock.lock();
        System.out.println("getHoldCount()=" + lock.getHoldCount());
        lock.unlock();
    }
}
